package com.zzy.web.controller.purchase;

import com.zzy.common.core.domain.AjaxResult;
import com.zzy.system.domain.PurchaseOrder;
import com.zzy.system.service.IPurchaseOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.sql.BatchUpdateException;

/**
 * 登录验证
 * 
 * @author zzy
 */
@Api(value = "Order", tags = {"祐全订单"}, hidden = false)
@RestController
public class PurchaseOrderController
{
    @Autowired
    private IPurchaseOrderService purchaseOrderService;

    @GetMapping("/getGuanmaiPurchaseOrderList")
    @ApiOperation("获取观麦采购订单")
    public AjaxResult getGuanmaiPurchaseOrderList(@RequestParam(value = "status",defaultValue = "3") Integer status,
                                                  @RequestParam("startDate") String startDate,
                                                  @RequestParam("endDate") String endDate,
                                                  @RequestParam(value = "offset",defaultValue = "0") Integer offset,
                                                  @RequestParam(value = "limit",defaultValue = "100") Integer limit) throws IOException, BatchUpdateException {
        AjaxResult ajax = AjaxResult.success();
        purchaseOrderService.getGuanmaiPurchaseOrderList( status, startDate, endDate, offset, limit);
        purchaseOrderService.getGuammaiPurchaseOrderDetails();
        return ajax;
    }

    @GetMapping("/getGuammaiPurchaseOrderDetails")
    @ApiOperation("获取观麦采购订单详情")
    public AjaxResult getGuammaiPurchaseOrderDetails() throws IOException, BatchUpdateException {
        AjaxResult ajax = AjaxResult.success();
        purchaseOrderService.getGuammaiPurchaseOrderDetails();
        return ajax;
    }


}
